﻿Imports System.Data.SqlClient
Public Class frmEmployee
    Public Sub load_data()
        DataGridView1.DataSource = cmd.ExecuteDataTable("select*from tblemployee where upper(em_code+emp_name) like upper('%" & txtSearch.Text & "%')")
    End Sub
    Private Sub frmEmployee_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        load_data()
    End Sub

    Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
        load_data()
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Dim row As DataGridViewRow = DataGridView1.SelectedRows(0)
        Dim code = row.Cells(0).Value
        cmd.ExecuteNonQuery("delete from tblemployee where em_id='" & code & "'")
        load_data()
    End Sub

    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
        Dim row As DataGridViewRow
        row = DataGridView1.SelectedRows(0)

    End Sub

    Private Sub btnnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnew.Click
        frmEmployee_Editter.ShowDialog()
    End Sub
End Class